package cn.kgc.InvitationManage.controller;

import cn.kgc.InvitationManage.pojo.invitation;
import cn.kgc.InvitationManage.service.InvitationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.xml.soap.Detail;
import java.util.List;

/**
 * @auhtor 司云杰
 * @create 2020-  01- 15-16:35
 */
@Controller
@RequestMapping("/invitation")
public class InvitationController {
    @Resource
    InvitationService invitationService;

    @RequestMapping(value = "/index")
    public String index(String title, Model model, @RequestParam(value = "pageIndex", required = false, defaultValue = "1") Integer pageIndex) {
        int pageSize = 2;
        PageHelper.startPage(pageIndex, pageSize);
        /*PageHelper.orderBy("publishdate desc");*/
        List<invitation> list = invitationService.invitationSelectBy(title);
        PageInfo<invitation> pageInfo = new PageInfo<>(list);
        model.addAttribute("pageInfo", pageInfo);
        return "index";
    }


}
